Skip to content

[APINotes] Add support for handling Clang modules carrying all versions of APINotes #75893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Aug 14, 2024

Controlled from Swift with -version-independent-apinotes, which, for the underlying Clang invocation enables -fswift-version-independent-apinotes, results in PCMs which aggregate all versioned APINotes wrapped in a SwiftVersionedAttr, with the intent to have the client pick and apply only those that match its current Swift version, discarding the rest.

Adapts Clang-side work as shown in swiftlang/llvm-project#9102.

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from 09a9578 to 5970e0f Compare August 14, 2024 19:41
@artemcm
Copy link
Contributor Author

artemcm commented Aug 14, 2024

@artemcm
Copy link
Contributor Author

artemcm commented Aug 15, 2024

swiftlang/llvm-project#9102
@swift-ci test Linux platform

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch 2 times, most recently from d6778a6 to f8bc917 Compare September 17, 2024 00:19
@artemcm
Copy link
Contributor Author

artemcm commented Sep 17, 2024

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from f8bc917 to c68a6a0 Compare October 23, 2024 21:36
@artemcm
Copy link
Contributor Author

artemcm commented Oct 23, 2024

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Oct 24, 2024

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from c68a6a0 to ab95963 Compare January 29, 2025 19:15
@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch 2 times, most recently from 3ca50b6 to dceacdd Compare June 17, 2025 21:07
@artemcm
Copy link
Contributor Author

artemcm commented Jun 17, 2025

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from dceacdd to 2e00d70 Compare June 17, 2025 22:39
@artemcm
Copy link
Contributor Author

artemcm commented Jun 17, 2025

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Jun 17, 2025

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from 2e00d70 to 81aefd4 Compare June 24, 2025 17:41
@artemcm
Copy link
Contributor Author

artemcm commented Jun 25, 2025

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jun 25, 2025

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from 81aefd4 to f7391d8 Compare June 25, 2025 20:56
@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch 2 times, most recently from 78558ba to b7cc827 Compare July 21, 2025 21:12
@artemcm
Copy link
Contributor Author

artemcm commented Jul 21, 2025

@swift-ci test

@artemcm artemcm marked this pull request as ready for review July 21, 2025 21:12
@artemcm artemcm marked this pull request as draft July 21, 2025 22:22
@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from b7cc827 to 7eab626 Compare July 21, 2025 23:06
@artemcm
Copy link
Contributor Author

artemcm commented Jul 21, 2025

@swift-ci test

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Jul 22, 2025

@swift-ci test

@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from 7eab626 to bd0b499 Compare July 22, 2025 17:32
@artemcm
Copy link
Contributor Author

artemcm commented Jul 22, 2025

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Jul 22, 2025

@swift-ci test

@artemcm artemcm marked this pull request as ready for review July 23, 2025 16:00
…ns of APINotes

Controlled from Swift with '-version-independent-apinotes', which, for the underlying Clang invocation enables '-fswift-version-independent-apinotes', results in PCMs which aggregate all versioned APINotes wrapped in a 'SwiftVersionedAttr', with the intent to have the client pick and apply only those that match its current Swift version, discarding the rest.

This change introduces the configuration flags for this mode as well as the corresponding logic at the beginning of `importDeclImpl` to canonicalize versioned attributes, i.e. select the appropriate attributes for the current target and discard the rest.
@artemcm artemcm force-pushed the SwiftAPINotesVersionedProto branch from 79322a4 to b60bc39 Compare July 24, 2025 16:08
@artemcm
Copy link
Contributor Author

artemcm commented Jul 24, 2025

@swift-ci smoke test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach makes sense to me, thank you!

@artemcm artemcm enabled auto-merge July 24, 2025 18:31
@artemcm artemcm merged commit c019093 into swiftlang:main Jul 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants